package com.woniu.product.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniu.product.infra.model.LxlgFootprint;
import com.woniu.product.infra.mapper.LxlgFootprintMapper;
import com.woniu.product.service.LxlgFootprintService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.product.service.dto.FootprintDto;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 浏览日志表(足迹表) 服务实现类
 * </p>
 *
 * @author Lucas
 * @since 2022-11-29
 */
@Service
public class LxlgFootprintServiceImpl extends ServiceImpl<LxlgFootprintMapper, LxlgFootprint> implements LxlgFootprintService {

    @Override
    public List<FootprintDto> getFootPrint(Integer userId) {
        List<LxlgFootprint> footprints = list(new QueryWrapper<LxlgFootprint>().eq("user_id", userId));
        List<FootprintDto> footprintDtos = BeanUtil.copyToList(footprints, FootprintDto.class);

        return footprintDtos;
    }
}
